<template>
	<view class="myOrderListAre">
		<view class="display column calc myOrderList borderR" v-for="(item,index) in orderList" :key="index" v-if="type=='order'">
			<view class="calc orderAre">
				<view class="display flow titleAre">
					<view class="display flow titleItemAre" @click="shopClick(item.supplier_id)">
						<image src="/static/images/icon/shopIcon.png"></image>
						<text class="shopName">{{item.supplier_name}}</text>
						<uni-icons :type="'arrowright'" :color="'grey'" size="16" />
					</view>
					<text class="themeColor">{{item.statusText}}</text>
				</view>
				<view class="display flow orderItemAre" v-for="(cell,idx) in item.content" :key="idx" @click="orderClick(item.id)">
					<image :src="cell.head_img" class="shopImg"></image>
					<view class="display display_1 column orderItemBoxAre">
						<view class="display flow orderItemBox">
							<view class="display column orderItem" style="width: 80%;">
								<text class="fontHide">{{cell.product_name}}</text>
								<text class="pColor fontHide marginTop">{{cell.attr_list.properties}}</text>
							</view>
							<view class="display column orderItem" style="align-items: flex-end;">
								<text>￥{{cell.attr_price}}</text>
								<text class="pColor marginTop">x{{cell.num}}</text>
							</view>
						</view>
						<view class="display flow refundTipAre" v-if="item.status == 5 || item.status == 7 || item.tk_status == 1">
							<text class="goldenColor">{{cell.statusText}}</text>
							<text class="goldenColor" v-if="cell.tkTime" style="margin-left: 10rpx;">{{cell.tkTime}}</text>
						</view>
					</view>
				</view>
				<view class="display flow mainAre">
					<view class="display column">
						<block v-if="item.is_card==1">
							<text>合计：<text class="price">￥{{item.realPrice}}</text><text class="pColor" style="text-decoration: line-through;">￥{{item.price}}</text></text>
						</block>
						<block v-else>
							<text>合计：<text class="price">￥{{item.price}}</text></text>
						</block>
					</view>
					<text class="goldenColor" v-if="item.tell_status == 1">已评论</text>
					<text class="goldenColor" v-if="item.tk_status == 1">已退款</text>
					<orderBtnAre :orderList="item" :isClose="item.isClose" @deleBtn="deleBtn" @payOk="payOk" :shopType="shopType" @logisticsClick="logisticsClick"></orderBtnAre>
				</view>
			</view>
		</view>
		<view class="display column calc myOrderList borderR" v-if="type=='orderDetails'">
			<view class="calc orderAre">
				<view class="display flow titleAre">
					<view class="display flow titleItemAre" @click="shopClick(orderList.supplier_id)">
						<image src="/static/images/icon/shopIcon.png" style="width: 32rpx;height: 29rpx;"></image>
						<text class="shopName">{{orderList.supplier_name}}</text>
						<uni-icons :type="'arrowright'" :color="'grey'" size="16" />
					</view>
				</view>
				<view class="display column" v-for="(item,idx) in orderList.content" :key="idx" >
					<view class="display flow orderItemAre" @click="goodsClick(item.product_id)">
						<image :src="item.head_img" class="shopImg" ></image>
						<view class="display display_1 column orderItemBoxAre">
							<view class="display flow orderItemBox">
								<view class="display column orderItem" style="width: 80%;">
									<text class="fontHide">{{item.product_name}}</text>
									<text class="pColor fontHide marginTop">{{item.attr_list.properties}}</text>
								</view>
								<view class="display column orderItem" style="align-items: flex-end;">
									<text>￥{{item.attr_price}}</text>
									<text class="pColor marginTop">x{{item.num}}</text>
								</view>
							</view>
							<view class="display flow refundTipAre"  v-if="orderList.status == 5 || orderList.status == 7 || orderList.tk_status == 1">
								<text class="goldenColor">{{item.statusText}}</text>
								<text class="goldenColor" v-if="item.tkTime" style="margin-left: 10rpx;">{{item.tkTime}}</text>
							</view>
						</view>
					</view>
					<view class="display flow refundBtnAre" v-if="!isShopOrder && orderList.profit_sharing != 1">
						<button class="display refundBtn themeBdColor" v-if="orderList.status == 1 || orderList.status == 2" @click="refundBtn(item)">退款</button>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import util from '@/common/util.js'
	import orderBtnAre from './orderBtnAre.vue'
	export default {
		name: "myOrderList",
		components: {orderBtnAre},
		props: ['orderList','type','isFx','shopType','isShopOrder'],
		data() {
			return {
				
			};
		},
		methods:{
			shopClick(id){
				uni.navigateTo({
					url: '/subPackages/goods/shopAre/shopAre?shopId=' + id
				})
			},
			goodsClick(id){
				if(this.isFx){
					let data = {
						id: id,
						disType: this.shopType,
						shopId: this.shopType==0?this.orderList.fx_user_shop_id:this.orderList.user_shop_id
					}
					uni.navigateTo({
						url: '/subPackages/shop/goodsDetails/goodsDetails?list=' + encodeURIComponent(JSON.stringify(data))
					})
				}else{
					uni.navigateTo({
						url: '/subPackages/goods/goodsDetails/goodsDetails?id='+ id
					})
				}
			},
			orderClick(id){
				uni.navigateTo({
					url: '/subPackages/mine/orderDetails/orderDetails?orderId=' + id + '&shopType=' + this.shopType
				})
			},
			deleBtn(){
				this.$emit('deleBtn')
			},
			payOk(){
				this.$emit('payOk')
			},
			refundBtn(list){
				let preferentialPrice = this.orderList.is_card ==1?Number(this.orderList.merchant_contribute) + Number(this.orderList.other_contribute) + Number(this.orderList.wxpay_contribute):0
				// console.log(preferentialPrice);
				uni.navigateTo({
					url: '/subPackages/mine/refundBtnAre/refundBtnAre?list=' + encodeURIComponent(JSON.stringify(list)) + '&preferentialPrice=' + preferentialPrice
				})
			},
			//物流信息
			logisticsClick(list){
				uni.navigateTo({
					url: '/subPackages/mine/logisticsAre/logisticsAre?list=' + encodeURIComponent(JSON.stringify(list))
				})
			},
		}
	}
</script>

<style lang="scss">
	@import '@/common/css/myOrderList.scss';
</style>
